package com.woniu.controller;

import cn.dev33.satoken.util.SaResult;
import com.woniu.entity.vo.MenuVo;
import com.woniu.service.CtfMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author hq
 * @Date 2025/6/14$ 14:02$
 * @Description TODO
 * @Params $
 * @Return $
 **/
@RestController
@RequestMapping("/menu")
public class CtfMenuController {
    @Autowired
    private CtfMenuService menuService;
    //查询一级菜单，二级菜单
    @GetMapping("/MenuList")
    public SaResult  getMenuList(){
        List<MenuVo> menuVos = menuService.selectMenuList();
        return SaResult.ok().setData(menuVos);
    }
    /**
     * @Author hq
     * 根据父id删除子id删除菜单
     */
    @GetMapping("/delete/{id}")
    public SaResult delete(@PathVariable("id") Integer id){
        menuService.deleteById(id);
        return SaResult.ok();
    }
}

